<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>职位管理</title>
    <link href="../../../static/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="../../../static/js/jquery.js"></script>
</head>
<script type="text/javascript">
    $(function () {

        //部门查询
        $.ajax({
            type: "post",
            url: "/dept/deptList",
            data: {},
            dataType: "JSON",
            success: function (rm) {
                var deptstr = '<option value="">请选择</option>';
                for (let i = 0; i < rm.data.length; i++) {
                    deptstr += '<option value="' + rm.data[i].deptId + '">' + rm.data[i].deptName + '</option>\n';
                }
                $("#jobDeptId").html(deptstr);
            },
            error: function (rm) {
                alert(rm.msg)
            }
        });

    })

    function jobSave() {
        $.ajax({
            type: "post",
            url: "/job/jobAdd",
            data: $("#Form").serializeArray(),
            traditional: true,
            async: true,
            dataType: "JSON",
            success: function () {
                window.location.href = "findByPage";
            },
            error: function (rm) {
                alert(rm.msg);
            }
        });
    }
</script>
<body>
<div class="place"><span>位置：</span>
    <ul class="placeul">
        <li><a href="../job/findByPage">系统管理</a></li>
        <li><a href="../job/findByPage">职位管理</a></li>
        <li><a href="../job/positionAdd">添加</a></li>
    </ul>
</div>
<form id="Form">
<div class="formbody">
    <div class="formtitle"><span>职位信息</span></div>
    <ul class="forminfo">
        <li>
            <label>职位名称</label>
            <input name="jobName" id="jobName" type="text" class="dfinput"/>
            <i>必填，不能超过30个字符</i>
        </li>
        <li><label>所属部门：</label>
            <select class="dfselect" name="jobDeptId" id="jobDeptId">
                <option value="">请选择部门</option>
                <option value="">研发</option>
                <option value="">销售</option>
                <option value="">财务</option>
            </select>
        </li>
        <li>
            <label>&nbsp;</label>
            <input name="" type="button" class="btn" value="确认保存" onclick="jobSave()"/>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="" type="button" class="btn" value="返回" onclick="window.history.go(-1);"/>
        </li>
    </ul>
</div>
</form>
</body>
